package com.aizuda.boot.modules.business.contract.entity.vo;

import com.aizuda.boot.modules.business.contract.entity.dto.ContractFieldDetailDTO;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.LocalDateTime;
import java.util.List;

@Data
@Schema(description = "合同详情VO")
public class ContractDetailRespDTO {

    @Schema(description = "合同基础信息")
    private ContractInfo contract;

    @Schema(description = "字段值列表")
    private List<ContractFieldDetailDTO> fieldValues;

    @Schema(description = "模块信息")
    private List<ContractModuleRespDTO> modules;

    @Data
    @Schema(description = "合同基础信息")
    public static class ContractInfo {

        @Schema(description = "合同ID")
        private Integer id;

        @Schema(description = "审批流程ID")
        private Long workflowId;

        @Schema(description = "合同编号")
        private String contractCode;

        @Schema(description = "合同名称")
        private String contractName;

        @Schema(description = "合同类型ID")
        private Integer contractTypeId;

        @Schema(description = "申请人用户ID")
        private Long applicantUserId;

        @Schema(description = "申请日期")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime applyDate;

        @Schema(description = "当前审批状态")
        private String currentStatus;

        @Schema(description = "创建时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime createdAt;

        @Schema(description = "更新时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime updatedAt;

        @Schema(description = "计价方式（1-固定总价，0-不固定总价）")
        private Integer pricingType;

        @Schema(description = "合同金额")
        private Double totalAmount;

        @Schema(description = "预估总额")
        private Double estimatedAmount;

        @Schema(description = "币种")
        private String currency;

        @Schema(description = "计费说明")
        private String billingDescription;

        @Schema(description = "合同期限类型（1-固定期限，0-不固定期限）")
        private Integer termType;

        @Schema(description = "合同开始时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime startDate;

        @Schema(description = "合同结束时间")
        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        private LocalDateTime endDate;

        @Schema(description = "是否框架协议（1-是，0-否）")
        private Integer frameworkAgreement;

        @Schema(description = "主合同文件地址")
        private String mainContractFileUrl;

        @Schema(description = "主合同文件ID")
        private Integer mainContractFileId;

        // 新增字段
        @Schema(description = "申请人姓名")
        private String applicantName;

        @Schema(description = "申请人头像")
        private String applicantAvatar;

        @Schema(description = "申请人部门")
        private String applicantDept;

        @Schema(description = "合同类型名称")
        private String contractTypeName;

        @Schema(description = "父合同类型名称")
        private String parentContractTypeName;
    }
}
